﻿@{
    ViewBag.Title = "内容主题管理";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
@model List<UcAsp.Net.Model.Subjects>
<div class="container-fluid">
    <div class="row-fluid">
        <span class="btn" id="addSubject">添加</span>
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon"><i class="icon-th"></i></span>
                <h5>主题类容管理</h5>
            </div>
            <div class="widget-content nopadding">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>编号
                            </th>
                            <th>名称
                            </th>
                            <th>图片
                            </th>
                            <th>关联分类
                            </th>
                            <th>关键词
                            </th>
                            <th>操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (UcAsp.Net.Model.Subjects s in Model)
                        {
                            <tr>
                                <td>
                                    @s.SubjectId
                                </td>
                                <td>
                                    @s.SubjectName
                                </td>
                                <td>
                                    <img alt="" src="@s.SubjectImg" style="max-width:300px;" />
                                </td>
                                <td style="max-width: 300px;">
                                    @s.CategoryName
                                </td>
                                <td>
                                    @s.Keywords
                                </td>
                                <td>
                                    <div class="btn-group">
                                        <a href="/admin/EditSubject?theme=@Request["theme"]&subjectid=@s.SubjectId&CId=@ViewData["CId"]@if (Request["Message"] != null)
                                                                                                                                       {<text>&Message=show</text>}">
                                            <button   class="btn btn-primary edit" data-id="@s.SubjectId">编辑</button></a>
                                        <button   class="btn btn-danger delete" data-theme="@Request["theme"]" data-message="@Request["Message"]" data-cid="@ViewData["CId"]" data-id="@s.SubjectId">删除</button>
                                    </div>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script>
    $(document).ready(function () {
        $(".delete").click(function () {
            $.post("/Admin/DeleteSubject", { subjectId: $(this).data("id"), theme: $(this).data("theme"), Message: $(this).data("message"), CId: $(this).data("cid") }, function (dataResult) {
                location.reload();
            });
        })
        $("#addSubject").click(function () {
            location.href = "/Admin/EditSubject?theme=@Request["theme"]&subjectid=0&CId=@ViewData["CId"]&message=@Request["Message"]"
        });
    })
</script>
